<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>reg-demo1</title>
  <style>
    textarea {
      height: 200px;
      width: 300px;
    }
    div {
      height: 60px;
      width: 300px;
      border: 1px solid black;
    }
  </style>
</head>

<body>
  <textarea name="" id=""></textarea>
  <button>提交</button>
  <div></div>

  <script>
    const tx = document.querySelector('textarea')
    const btn = document.querySelector('button')
    const dv = document.querySelector('div')
    // 绑定点击事件
    btn.addEventListener('click',function(){
      // console.log(tx.value);
      // 正则表达式判断
      dv.innerHTML = tx.value.replace(/蠢|笨/g,'**')
      tx.value = ''
    })
  </script>
</body>
</html>